package com.xsjiong.jaript;

import java.util.ArrayList;

public class JStringPool {
	private ArrayList<String> S = new ArrayList<>();

	public JStringPool() {
	}

	public int putString(String s) {
		int index = S.indexOf(s);
		if (index != -1) return index;
		S.add(s);
		return S.size() - 1;
	}

	public String getString(int i) {
		return S.get(i);
	}

	public void clear() {
		S.clear();
	}

	public void removeString(String s) {
		S.remove(s);
	}

	public ArrayList<String> getRaw() {
		return S;
	}
}
